import os
import unittest
from cases.Base_Case import BASECASE
from config.config import DATA_PATH
from page.index import IndexPage
from page.门诊医生站.门诊医生站.SOAP__page import SOAP
from page.门诊医生站.门诊医生站.feiyaowuchufang__page import Feiyaowuchufang
from page.门诊医生站.门诊医生站.jianchajianyan__page import Jianchajianyan
from page.门诊医生站.门诊医生站.menzhenyishengzhan__page import menzhenyishengzhan
from page.门诊医生站.门诊医生站.xiyaochengyaochufang__page import Xiyaochengyaochufang
from page.门诊医生站.门诊医生站.zhongyaochufang__page import Zhongyaochufang
from tools.sjqd_way import read_data_from_excel
class TestMenzhenyishengzhan(BASECASE):
    @classmethod
    def setUpClass(cls):
        ap = IndexPage()
        ap.jrym_no1('门诊医生站')
    @classmethod
    def tearDownClass(cls):
        ap = IndexPage()
        ap.close_all_xxk()
        print("{}执行完毕-------------------------------------------------".format(cls))
    def test_1_menzhenyishengzhan(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        bp = menzhenyishengzhan()
        bp.click_dendai_btn()#点击等待
        bp.click_quanbubingren_btn()#点击全部病人
        bp.input_name(name)#输入患者名字
        bp.click_shuaxin_btn()#点击刷新
        bp.double_click_huanzhe_btn()#双击患者
    def test_2_menzhenyishengzhan_SOAP(self):
        #SOAP
        cp = SOAP()
        cp.click_SOAP_btn()#点击SOAP
        cp.choose_zdjg_btn()#选择诊断

    def test_3_menzhenyishengzhan_XYCF(self):
        #西药处方
        dp = Xiyaochengyaochufang()
        bp = menzhenyishengzhan()
        dp.click_xycycf_btn()  # 点击西药成药处方
        bp.add_xinzu(2)#添加2个新组
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "西药成药处方")
        ypmc_xy,cs_xy,yf_xy= self.data[0]
        dp.input_xy1(ypmc_xy,cs_xy,yf_xy)
        ypmc_xy,cs_xy,yf_xy = self.data[1]
        dp.input_xy2(ypmc_xy,cs_xy,yf_xy)
        dp.choose_ps1()
    def test_4_menzhenyishengzhan_ZYCF(self):
        #中药处方
        bp = menzhenyishengzhan()
        ep = Zhongyaochufang()
        ep.click_zycf_btn()#点击中药处方
        bp.add_xinzu(2)
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "中药处方")
        ypmc, jf, yf, cs = self.data[0]
        ep.input_zy1(ypmc, jf, yf, cs)
        ypmc, jf, yf, cs = self.data[1]
        ep.input_zy2(ypmc, jf, yf, cs)
    @unittest.skip('不想执行')
    def test_5_menzhenyishengzhan_FYWCF(self):
        #非药物处方
        bp = menzhenyishengzhan()
        fp = Feiyaowuchufang()
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "非药物处方")
        xmmc1,xmmc2,xmmc3,xmmc4,xmmc5 = self.data[0][0],self.data[1][0],self.data[2][0],self.data[3][0],self.data[4][0]
        fp.click_feiyaowuchufang_btn()#点击非药物处方
        bp.add_hang(5)
        fp.input_all(xmmc1,xmmc2,xmmc3,xmmc4,xmmc5)

    def test_6_menzhenyishengzhan_JCJY(self):
        #检查检验
        bp = menzhenyishengzhan()
        gp = Jianchajianyan()
        gp.click_jianyanjiancha_btn()
        bp.add_hang(1)
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "检验检查")
        xmmc1 = self.data[2][0]
        gp.choose_jyjc_xmmc1(xmmc1)
        bp.click_savebtn()#点击保存
        bp.click_ts_ok()#点击确定按钮
        bp.click_yl_close()#点击预览关闭
if __name__ == '__main__':
    unittest.main()
